package com.tcloudit.system.api.factory;

import com.tcloudit.common.core.domain.R;
import com.tcloudit.common.core.web.domain.AjaxResult;
import com.tcloudit.system.api.RemoteRoleService;
import com.tcloudit.system.api.domain.CamundaUserPost.PostProcessStatus;
import com.tcloudit.system.api.domain.CamundaUserPost.UserPost;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 用户服务降级处理
 *
 * @author ruoyi
 */
@Component
public class RemoteRoleFallbackFactory implements FallbackFactory<RemoteRoleService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteRoleFallbackFactory.class);

    @Override
    public RemoteRoleService create(Throwable cause) {
        log.error("岗位服务调用失败：{}", cause.getMessage());
        return new RemoteRoleService() {

            @Override
            public R<List<String>> selectUserIdAuth(String userId) {
                return R.fail("获取岗位失败");
            }
        };
    }
}
